fix: Enable Google Ads conversion tracking with consent mode #9009
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Google Ads conversions were not being tracked in production. The
window.gtag()function executed but sent no network requests to Google servers.Root Cause Analysis
Two issues were preventing conversion tracking:
wait_for_update: 500was blocking all eventsMissing config re-initialization after consent granted
gtag('config')was never called again to flush queued eventsSolution
This PR implements two critical fixes:
1. Remove
wait_for_updateparameterRemoved the
wait_for_update: 500parameter from consent defaults. This allows gtag to send anonymized conversion pings immediately, even when consent is denied.2. Re-initialize config after consent granted
Added
window.gtag('config', GTM_ID)call inupdateConsentGranted()function. When users accept cookies, this flushes any queued events and enables full conversion tracking.Expected Behavior After Fix
WITHOUT user consent:
WITH user consent:
Testing
To verify the fix works:
googleads.g.doubleclick.netFiles Changed
apps/web-roo-code/src/components/providers/google-analytics-provider.tsxRelated Issues
Fixes the issue where Google Ads conversion tracking appeared to execute but sent no network requests in production.
Important
Fixes Google Ads conversion tracking by removing
wait_for_updateand re-initializing config after consent ingoogle-analytics-provider.tsx.wait_for_update: 500from consent defaults ingoogle-analytics-provider.tsxto allow immediate anonymized conversion pings.window.gtag('config', GTM_ID)inupdateConsentGranted()to flush queued events after consent is granted.googleads.g.doubleclick.neton/reviewerpage and after clicking 'Start 14-day Free Trial'.This description was created by
for 276d1ff. You can customize this summary. It will automatically update as commits are pushed.